home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CPeep.as < prev    next >
Text File  |  2011-08-19  |  10KB  |  326 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.CAngle;
  4.    import Local.Game.World.CPosition;
  5.    import Local.Math.CRandom;
  6.    
  7.    public class CPeep extends CThingSprite
  8.    {
  9.       
  10.       public static const mStandHeight:Number = 70 * mSpriteScalar;
  11.       
  12.       public static const mCrouchHeight:Number = 54 * mSpriteScalar;
  13.       
  14.       public static const mProneHeight:Number = 20 * mSpriteScalar;
  15.        
  16.       
  17.       var mNode:CNode;
  18.       
  19.       var mPrimaryWeapon:CWeapon;
  20.       
  21.       public function CPeep(param1:CPosition)
  22.       {
  23.          super();
  24.          mBaseType = "peep";
  25.          mAngle = new CAngle();
  26.          mPosition = param1;
  27.          mDelta = new CPosition();
  28.          mRandom = new CRandom(nID);
  29.          zDepth = 200;
  30.          mNode = new CNode(mPosition,this);
  31.          mNode.mBounce = 0;
  32.          mAnimationFrame = Math.random();
  33.          mWeaponDelta = new CPosition();
  34.          mMaxLife = mLife = 100;
  35.          mShowOnMap = true;
  36.          MapAdd();
  37.          mCollide = new CTCollideHeight(this,30 * mSpriteScalar,mStandHeight);
  38.       }
  39.       
  40.       public function State_MOUSEOVER_Enter() : void
  41.       {
  42.       }
  43.       
  44.       public function State_GOTO_Exit() : void
  45.       {
  46.       }
  47.       
  48.       public function GetShotDelta(param1:String) : CPosition
  49.       {
  50.          return mWeaponDelta.Clone();
  51.       }
  52.       
  53.       public function State_TARGET_Exit() : void
  54.       {
  55.          mPrimaryWeapon.mFire = false;
  56.       }
  57.       
  58.       public function State_MOUSEOVER_Exit() : void
  59.       {
  60.       }
  61.       
  62.       public function State_GOTO() : void
  63.       {
  64.          if(true)
  65.          {
  66.             ┬º┬ºpush(mNode);
  67.             if(true)
  68.             {
  69.                ┬º┬ºpush(┬º┬ºpop().hasTraction);
  70.                if(true)
  71.                {
  72.                   if(┬º┬ºpop())
  73.                   {
  74.                      if(true)
  75.                      {
  76.                         mAnimationFrame += 0.1;
  77.                         if(true)
  78.                         {
  79.                            Accelerate_Gradient(mDelta,mGradient);
  80.                            if(true)
  81.                            {
  82.                               ┬º┬ºpush(mNode);
  83.                               if(true)
  84.                               {
  85.                                  ┬º┬ºpop().Move(mDelta);
  86.                                  if(true)
  87.                                  {
  88.                                     ┬º┬ºpush(Boolean(mMouseOver));
  89.                                     if(true)
  90.                                     {
  91.                                        if(┬º┬ºpop())
  92.                                        {
  93.                                           ┬º┬ºpop();
  94.                                           if(true)
  95.                                           {
  96.                                              addr59:
  97.                                              if(mGroupID == GROUPID_FRIEND)
  98.                                              {
  99.                                                 if(true)
  100.                                                 {
  101.                                                    SetState_ReturnAndCount("MOUSEOVER",mStateID,SECONDS / 2);
  102.                                                    addr70:
  103.                                                    mNode.Update();
  104.                                                    addr69:
  105.                                                 }
  106.                                                 if(!MapMove())
  107.                                                 {
  108.                                                 }
  109.                                                 ┬º┬ºgoto(addr78);
  110.                                              }
  111.                                              ┬º┬ºgoto(addr69);
  112.                                           }
  113.                                           if(Process_ReachedObjective())
  114.                                           {
  115.                                              ┬º┬ºgoto(addr77);
  116.                                           }
  117.                                           else
  118.                                           {
  119.                                              ┬º┬ºgoto(addr78);
  120.                                           }
  121.                                        }
  122.                                     }
  123.                                     ┬º┬ºgoto(addr59);
  124.                                  }
  125.                                  addr77:
  126.                                  return;
  127.                               }
  128.                               ┬º┬ºgoto(addr70);
  129.                            }
  130.                            ┬º┬ºgoto(addr78);
  131.                         }
  132.                         ┬º┬ºgoto(addr81);
  133.                      }
  134.                      ┬º┬ºgoto(addr98);
  135.                   }
  136.                   ┬º┬ºgoto(addr70);
  137.                }
  138.                ┬º┬ºgoto(addr78);
  139.             }
  140.             addr78:
  141.             if(mNode.hasTraction)
  142.             {
  143.                addr81:
  144.                if((mCurrentTarget = GetTarget()) != null)
  145.                {
  146.                   addr98:
  147.                   SetState("TARGET");
  148.                }
  149.                ┬º┬ºgoto(addr101);
  150.             }
  151.             addr101:
  152.             return;
  153.          }
  154.          ┬º┬ºgoto(addr98);
  155.       }
  156.       
  157.       public function State_WAIT() : void
  158.       {
  159.          if(true)
  160.          {
  161.             if((mCurrentTarget = GetTarget()) != null)
  162.             {
  163.                if(true)
  164.                {
  165.                   SetState("TARGET");
  166.                   if(true)
  167.                   {
  168.                      return;
  169.                   }
  170.                   addr36:
  171.                   if(mStateCount < 0)
  172.                   {
  173.                   }
  174.                   ┬º┬ºgoto(addr49);
  175.                }
  176.                SetState("GOTO");
  177.                addr49:
  178.                return;
  179.             }
  180.          }
  181.          ┬º┬ºgoto(addr36);
  182.       }
  183.       
  184.       public function State_MOUSEOVER() : void
  185.       {
  186.          if(true)
  187.          {
  188.             ┬º┬ºpush(mStateCount < 0);
  189.             if(mStateCount < 0)
  190.             {
  191.                ┬º┬ºpop();
  192.                if(true)
  193.                {
  194.                   addr28:
  195.                   if(mMouseOver)
  196.                   {
  197.                   }
  198.                   ┬º┬ºgoto(addr32);
  199.                }
  200.                SetState(mReturnStateID);
  201.                addr32:
  202.                return;
  203.             }
  204.          }
  205.          ┬º┬ºgoto(addr28);
  206.       }
  207.       
  208.       public function GetShotPosition(param1:String) : CPosition
  209.       {
  210.          return GetObjectPosition(param1,mPosition);
  211.       }
  212.       
  213.       public function State_TARGET() : void
  214.       {
  215.          var _loc1_:Object = null;
  216.          var _loc2_:CPosition = null;
  217.          var _loc3_:CPosition = null;
  218.          var _loc4_:Number = NaN;
  219.          var _loc5_:Number = NaN;
  220.          if(mCurrentTarget.mDead)
  221.          {
  222.             mStateCount = Math.round((Math.random() * 0.5 + 0.75) * SECONDS);
  223.             SetState("WAIT");
  224.             return;
  225.          }
  226.          _loc1_ = mPrimaryWeapon.mAngleRange;
  227.          _loc2_ = mCollide.mMid;
  228.          _loc3_ = mCurrentTarget.mCollide.mMid;
  229.          if(true)
  230.          {
  231.             mWeaponDelta.SetXY(_loc3_.x - _loc2_.x,_loc3_.y - _loc2_.y);
  232.             if(true)
  233.             {
  234.                _loc4_ = Math.round(mWeaponDelta.GetAngleDEG(mOrientation) * mOrientation);
  235.                if(true)
  236.                {
  237.                   mAnimationFrame = 1 - (_loc4_ - _loc1_.min) / (_loc1_.max - _loc1_.min + 1);
  238.                   if(true)
  239.                   {
  240.                      _loc5_ = mWeaponDelta.length / 10 * (1 - mPrimaryWeapon.mAccuracy);
  241.                      if(true)
  242.                      {
  243.                         mWeaponDelta.y += Math.random() * _loc5_ - _loc5_ * 0.5;
  244.                      }
  245.                      GetAnimationFrame();
  246.                   }
  247.                   mPrimaryWeapon.mFire = true;
  248.                }
  249.                if(!mPrimaryWeapon.mFired)
  250.                {
  251.                }
  252.                ┬º┬ºgoto(addr150);
  253.             }
  254.             mPrimaryWeapon.mFired = false;
  255.          }
  256.          addr150:
  257.       }
  258.       
  259.       public function State_GOTO_Enter() : void
  260.       {
  261.          mCollide["mHeight"] = mStandHeight;
  262.          SetAnimation("run");
  263.       }
  264.       
  265.       override public function Draw() : void
  266.       {
  267.          super.Draw();
  268.          GetAnimationFrame();
  269.          DrawSprite(GetOrientationMatrix());
  270.       }
  271.       
  272.       public function State_WAIT_Exit() : void
  273.       {
  274.       }
  275.       
  276.       public function Process_Normal() : void
  277.       {
  278.          if(Process_State != null)
  279.          {
  280.             Process_State();
  281.          }
  282.          Process_Children();
  283.          if(mDead)
  284.          {
  285.             ExplodeSmall();
  286.             DispatchDispose();
  287.          }
  288.       }
  289.       
  290.       public function State_TARGET_Enter() : void
  291.       {
  292.          if(true)
  293.          {
  294.             mAnimationFrame = 0.5;
  295.             if(true)
  296.             {
  297.                if(Math.random() >= 0.5)
  298.                {
  299.                   if(true)
  300.                   {
  301.                      mCollide["mHeight"] = mCrouchHeight;
  302.                      SetAnimation("crouchaim");
  303.                   }
  304.                   ┬º┬ºgoto(addr51);
  305.                }
  306.                else
  307.                {
  308.                   mCollide["mHeight"] = mStandHeight;
  309.                }
  310.                ┬º┬ºgoto(addr51);
  311.             }
  312.             SetAnimation("standaim");
  313.          }
  314.          addr51:
  315.       }
  316.       
  317.       public function State_WAIT_Enter() : void
  318.       {
  319.          if(true)
  320.          {
  321.             mSpeed = 0;
  322.          }
  323.       }
  324.    }
  325. }
  326.